<?php

class Module
{
    private $_module;
    private $_db;
    
    public function __construct($module)
    {
        $this->_db = new PDO('mysql:host=localhost;port=3306;dbname=mediadevil','localuser','localpasswd');
        $this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        
        $this->setModuleName($module);
        $this->getProperties();
    }
    
    private function setModuleName($module)
    {
        $this->_module = $module;    
    }
    
    private function getModuleName()
    {
        return $this->_module;
    }
    
    public function getProperties()
    {
        $sql = 'SELECT * FROM media_'.$this->_module;
        if(!$query = $this->_db->query($sql)) return false;
        
        while($result = $query->fetch(PDO::FETCH_ASSOC))
        {
            echo '<pre>';
            var_dump($result);
            foreach ($result as $key=>$value)
            {
                $this->$key = $result[$key];
            }
        }
        
        return true;
    }
    
    public function __destruct()
    {
        
    }
}

$aap = new Module('audio');
echo $aap->audio_artist; 